﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;

namespace HQPad.Models
{
    public class Skill
    {
        public int SkillID { get; set; }

        [ForeignKey("Rules")]
        public int RuleSetID { get; set; }
        public virtual RuleSet Rules { get; set; }

        [Display(Name = "Skill name")]
        [Required(ErrorMessage = "A skill name is required")]
        [MaxLength(50, ErrorMessage = "The skill name is limited to 50 characters")]
        public string Name { get; set; }

        [Display(Name = "Legacy skill name")]
        [MaxLength(50, ErrorMessage = "The legacy skill name is limited to 50 characters")]
        public string LegacyName { get; set; }

        [Display(Name = "Unique skill slug")]
        [Required(ErrorMessage = "A skill slug is required")]
        [MaxLength(50, ErrorMessage = "The skill slug is limited to 50 characters")]
        public string Slug { get; set; }

        public bool Deleted { get; set; }

        [Display(Name = "Last updated")]
        [DisplayFormat(DataFormatString = "{0:d}", ApplyFormatInEditMode = true)]
        public DateTime? LastUpdated { get; set; }

        [Display(Name = "Last updated by")]
        public int? LastUpdatedByUserID { get; set; }

        [Display(Name = "Max ranks")]
        public int? MaxRanks { get; set; }

        [Required(ErrorMessage = "The basic skill flag is required")]
        [Display(Name = "Is a basic skill")]
        public bool IsBasic { get; set; }

        public virtual ICollection<SkillCost> Costs { get; set; }

        public virtual ICollection<SkillRequirement> Requirements { get; set; }

        [Display(Name = "Skill status cost per rank.")]
        public int? Status { get; set; }

        [Display(Name = "Skill Group")]
        [Required(ErrorMessage = "A skill group is required")]
        [MaxLength(20, ErrorMessage = "The type of skill is limited to 20 characters")]
        [RegularExpression("Martial|Archer|Physical|Medical|Magic|Power|Subterfuge|Armour|Potion|Ki|Adrenal|Psi|Royal|Other|Special128|Special256")]
        public string TypeOfSkill { get; set; }

        public virtual ICollection<Bonus> Bonuses { get; set; }

        [Display(Name = "Skill description")]
        public string Description { get; set; }
    }
}